package com.ukao.pad.rfid;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by ukaodev on 2017/6/3.
 */

public class UserInfoEvent<T> {
    public T data;
    public Message msg;

    public static enum Message {
        VIP,NAME,SEX,TAG,BIRTH,CLOSE,BING,UNBING,USEINFO,BINGOK,NOTCARD,LOSSCARD,CODEBING
    }

    public UserInfoEvent() {

    }

    public UserInfoEvent(Message msg, T data) {
        this.msg = msg;
        this.data = data;
    }
    public UserInfoEvent(Message msg) {
        this.msg = msg;
    }

    public Message getMessage() {
        return msg;
    }

    public <T> T getData() {
        if (data == null) {

        }
        return (T) data;
    }

    public static <T> void postHasData(Message msg, T data) {
        EventBus.getDefault().postSticky(new UserInfoEvent(msg, data));
    }
    public static <T> void postNoData(Message msg) {
        EventBus.getDefault().post(new UserInfoEvent(msg));
    }
}
